﻿using System;
using System.Collections.Generic;
using JinianNet.JNCms.Models;

namespace JinianNet.JNCms.Data
{
    public interface IUsers
    {
        /// <summary>
        /// 添加
        /// </summary>
        int Insert(Users model);
        /// <summary>
        /// 修改
        /// </summary>
        int Update(Users model);
        /// <summary>
        /// 删除
        /// </summary>
        int Delete(int id);
        /// <summary>
        /// 列表
        /// </summary>
        List<Users> GetList(int id, int pageIndex, int pageSize);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="key"></param>
        /// <param name="keyType"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        List<Users> GetList(int id,string key,string keyType, int pageIndex, int pageSize);

        /// <summary>
        /// 明细
        /// </summary>
        Users GetItem(string item);
        /// <summary>
        /// 明细
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Users GetItem(int id);

        /// <summary>
        /// 获取用户找回密码的加密字符串
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        void CreatePasswordSign(string account, string sign, DateTime date);

        /// <summary>
        /// 更新用户登陆成功成功信息
        /// </summary>
        /// <param name="account"></param>
        /// <param name="ip"></param>
        /// <param name="date"></param>
        void LoginSuccess(string account,string ip,DateTime date);

        /// <summary>
        /// 更新用户失败信息
        /// </summary>
        /// <param name="account"></param>
        /// <param name="ip"></param>
        /// <param name="date"></param>
        void LoginFail(string account, string ip, DateTime date);


        /// <summary>
        /// 更新基本信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        int UpdateInformation(Users model);

        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="account"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        int UpdatePassword(string account,string password);

        /// <summary>
        /// 修改安全问题与答案
        /// </summary>
        /// <param name="account"></param>
        /// <param name="question"></param>
        /// <param name="answer"></param>
        /// <returns></returns>
        int UpdateSafeQuestion(string account, string question, string answer);

        /// <summary>
        /// 修改身份证
        /// </summary>
        /// <param name="account"></param>
        /// <param name="card"></param>
        /// <returns></returns>
        int UpdateIDCard(string account, string card);


    }
    public partial class DataAccess
    {
        public static IUsers CreateUsers()
        {
            return (IUsers)CreateObject(".Users");
        }
    }
}
